import '@nomicfoundation/hardhat-ethers'
import 'hardhat-deploy'
import { task } from 'hardhat/config'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import { MyToken } from '../typechain-types'

export const mintNFT = task('mint-nft').setAction(async (taskArgs, hre: HardhatRuntimeEnvironment) => {
  const { firstAccount } = await hre.getNamedAccounts()
  const nft = await hre.ethers.getContract<MyToken>('MyToken', firstAccount)
  const mintTx = await nft.safeMint(firstAccount)
  mintTx.wait(6)
  console.log('NFT minted')
})
